package com;

import java.io.UnsupportedEncodingException;

public class TgetInt2 {

    public static int getTwoHolderConvert(int hValue, int lVaule) {
        int l = getOndHolderConvert(hValue);
        int h = getOndHolderConvert(lVaule)<<16;
        int value = l + h;
        return value;
    }

    public static int getOndHolderConvert(int valueShort) {
        byte valueBytes[] = toByteArray((short) valueShort);
        int value_L = (valueBytes[0] & 0xff);
        int value_H = (valueBytes[1] & 0xff) << 8;
        int value = value_H + value_L;

        return value;
    }

    static public void main(String[] argv) {
        int a = 0;
        int b = 10;
        a = (a << 160) + 10;
        a = 0;

        int a1 = 0x03E8;
        int b1 = 0xC1B2;


        int ss = getOndHolderConvert(a1);
        int cc = getTwoHolderConvert(a1, b1);


        byte a1Bytes[] = toByteArray((short) a1);
        byte b1Byte[] = toByteArray((short) b1);

        int a1_L = (a1Bytes[0] & 0xff);
        int a1_H = (a1Bytes[1] & 0xff) << 8;
        int L = a1_H + a1_L;


        int c1 = 0x00E8;
        c1 = c1 << 16;

        short one = (short) ((int) a1);
        byte bc[] = toByteArray(one);
        int dd = (bc[1] & 0xff);
        int aaa = (bc[1] & 0xff) << 8;
        aaa = aaa >> 16;
        if (aaa < 0) {
            aaa = aaa << 16 >> 16;
        }

        int l = ((((int) bc[1]) << 8) + (int) bc[0]);

        long la = UnsignedUtil.getUnsignedInt(l);


        short two = (short) ((int) b1);
        byte bq[] = toByteArray(two);

        int h = (((int) bq[1]) << 8) + (int) bq[0];


        int cs = (h << 16) + l;


        byte[] str = null;
        try {
            str = "丁".getBytes("gb2312");
            a = 0;
            a = 0;
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }


    }

    public static byte[] toByteArray(short i16) {
        return new byte[]{byteHigh(i16), byteLow(i16)};
    }

    public static byte byteLow(int b) {
        return (byte) ((short) b & 0xff);
    }

    public static byte byteHigh(int b) {
        return (byte) (((short) b >> 8) & 0xff);
    }
}
